<template>
  <div>
    <!--    面包屑导航  -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>数据统计</el-breadcrumb-item>
      <el-breadcrumb-item>数据报表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <div id="chart" style="width: 800px;height:400px;"></div>
    </el-card>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        queryInfo:{
          query:'',
          pagenum:1,
          pagesize:3
        },
        dataList:[],
      }
    },
    created () {
      this.getDataList()
    },
    methods: {
      async getDataList () {
        const { data : res } = await this.$http.get('reports/type/1',{ params : this.queryInfo})
        if(res.meta.status !== 200) return this.$message.error('获取数据报表失败')
        this.dataList = res.data
        //待DOM元素绘制完成再进行图标渲染
        setTimeout(() => {
          var myChart = this.$echarts.init(document.getElementById('chart'))
          myChart.setOption(this.dataList)
        },500)

      },
    }
  }
</script>
<style lang="less">

</style>
